package com.ymatou.iapi.godmch.service;

import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.ymatou.iapi.godmch.parameter.mchInfo;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*查询商户信息（运营后台）idCall
*FreeMaker Template自动生成代码
*/
public class GetListByConditionCall extends YmatouBaseCall{
	private static String opurl ="api/mch/GetListByCondition";
	
	public GetListByConditionCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	 public String getStatus1()
	{
		  return getString("status");
	}
		
    public String getMessage()
	{
		 return getString("msg");
	}
	public mchInfo getMchInfo() {
		mchInfo data = null;
		try {
			//data = (mchInfo) FormatUtil.GSONToObject(new JSONObject(getString("result").toString()).getString("permissionDtos"), mchInfo.class);
			data = (mchInfo) new Gson().fromJson(getJsonObject().get("result").getAsJsonObject().get("mchInfo").getAsJsonObject().toString(), new TypeToken<mchInfo>() {}.getType());

		} catch (Exception e) {
			e.printStackTrace();
		}
		return data;
	}
}